package com.person.common.utils;

import org.springframework.stereotype.Component;

@Component
public class selfValue {



    public static double selfValue(Float mustSalary, Float fundAmount, Float taxAmount, Float medicalAmount, Float injuredAmount) { // 个人所得税具体计算
        double sefValue;

        if (mustSalary >= 0 && mustSalary < 1500) {
            sefValue =  (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.03 - 0;
        } else if (mustSalary >= 1500 && mustSalary < 4500) {
            sefValue =  (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.1 - 105;

        } else if (mustSalary >= 4500 && mustSalary < 9000) {
            sefValue = (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.2 - 555;

        } else if (mustSalary >= 9000 && mustSalary < 35000) {
            sefValue =  (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.25 - 1005;

        } else if (mustSalary >= 35000 && mustSalary < 55000) {
            sefValue =  (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.30 - 2755;

        } else if (mustSalary >= 55000 && mustSalary < 80000) {
            sefValue =  (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount) * 0.35 - 5505;

        } else {
            sefValue = (mustSalary - fundAmount - taxAmount + medicalAmount -injuredAmount ) * 0.45 - 13505;

        }
        return sefValue;
    }
}
